﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SqlsugarService.Application.DTOs.LMZWorkSchedule
{
    /// <summary>
    /// 质检方案返回Dto
    /// </summary>
    public class QualityInspectionDto
    {
        public Guid Id {  get; set; }
        /// <summary>
        /// 质检方案名称
        /// </summary>
        public string PlanName { get; set; }

        /// <summary>
        /// 质检方案编号
        /// </summary>
        public string PlanCode { get; set; }

        /// <summary>
        /// 检测分类 (如：产品, 物料)
        /// </summary>
        public string DetectionCategory { get; set; }

        /// <summary>
        /// 检测种类 (多个以逗号分隔, 如: 首检,自检,中检)
        /// </summary>
        public string DetectionTypes { get; set; }

        /// <summary>
        /// 状态 (如: 启用, 禁用)
        /// </summary>
        public string Status { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 版本号
        /// 每次修改关联关系时递增，用于跟踪变更历史
        /// </summary>
        [SugarColumn(DefaultValue = "1")]
        public int Version { get; set; } = 1;

        /// <summary>
        /// 版本描述
        /// 记录本次版本变更的原因或内容
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 500)]
        public string? VersionDescription { get; set; }

        /// <summary>
        /// 是否为当前有效版本
        /// true: 当前有效版本, false: 历史版本
        /// </summary>
        [SugarColumn(DefaultValue = "true")]
        public bool IsCurrentVersion { get; set; } = true;

        /// <summary>
        /// 版本生效时间
        /// </summary>
        public DateTime EffectiveTime { get; set; } = DateTime.UtcNow;

        /// <summary>
        /// 版本失效时间
        /// 当创建新版本时，旧版本的失效时间会被设置
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime? ExpiryTime { get; set; }
    }
}
